//
//  DZZanManager.m
//  DaZhePrivateHomeCuisineClient
//
//  Created by zouzhisheng on 15/3/30.
//  Copyright (c) 2015年 zouzhisheng. All rights reserved.
//

#import "DZZanManager.h"

static DZZanManager *shareZanManager=nil;
@implementation DZZanManager
+(DZZanManager *)shareZanManager{
    @synchronized(self) {
        if(shareZanManager == nil) {
           shareZanManager= [[[self class] alloc] init];
        }
    }
    return shareZanManager;
}
-(BOOL)addZan:(NSString *)sid{
    NSUserDefaults *userDefault=[NSUserDefaults  standardUserDefaults];
    if (![userDefault  doubleForKey:sid]) {
        NSDate *curDate=[NSDate date];
        [userDefault setDouble:[curDate timeIntervalSince1970] forKey:sid];
        return YES;
    }else{
       
        NSTimeInterval lastTime=[userDefault  doubleForKey:sid];
        NSTimeInterval nowTime=[[NSDate date] timeIntervalSince1970];
        if (nowTime-lastTime>5*60) {
        [userDefault setDouble:nowTime forKey:sid];
            return YES;
        }else{
            return NO;
        }
    }
}
@end
